package com.lmabbe.tenant.objects.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * @author lmabbe
 */
@Data
@ApiModel(value = "租户安装参数")
public class TenantInstallContextDTO {

    @NotEmpty(message = "租户ID不能为空")
    @ApiModelProperty(value = "租户ID")
    private Long tenantId;

    @NotEmpty(message = "租户ID不能为空")
    @ApiModelProperty(value = "租户基础信息")
    private TenantInfoDTO tenantInfo;

    @ApiModelProperty(value = "租户数据库信息")
    private List<TenantDatabasesDTO> tenantDatabases;

    @ApiModelProperty(value = "租户小程序信息")
    private List<TenantMiniappDTO> tenantMiniapps;

    @ApiModelProperty(value = "租户系统参数")
    private List<ContextSysParamsDTO> sysParams;

    @ApiModelProperty(value = "租户字典表")
    private List<ContextSysDictDTO> sysDices;

    @ApiModelProperty(value = "租户认证客户端信息")
    private List<ContextOauthClientDTO> clients;

    @ApiModelProperty(value = "租户模块资源")
    private List<ContextModuleResourceDTO> resources;


    @Data
    public static class ContextSysDictDTO extends SysDicDTO {
        /**
         * 参数名称
         */
        @ApiModelProperty(value = "参数ID")
        private String dicId;

        @ApiModelProperty(value = "是否强制更新")
        private Boolean force;


        /**
         * 参数名称
         */
        @ApiModelProperty(value = "参数ID")
        private List<ContextSysDictItemDTO> children;

    }

    @Data
    public static class ContextSysDictItemDTO extends SysDicItemDTO {
        /**
         * 参数名称
         */
        @ApiModelProperty(value = "参数ID")
        private String itemId;

        @ApiModelProperty(value = "是否强制更新")
        private Boolean force;
    }

    @Data
    public static class ContextSysParamsDTO extends SysParamsDTO {
        /**
         * 参数名称
         */
        @ApiModelProperty(value = "参数ID")
        private String paramId;

        @ApiModelProperty(value = "是否强制更新")
        private Boolean force;
    }

    @Data
    public static class ContextModuleResourceDTO extends ModuleResourceDTO {
        @ApiModelProperty(value = "资源ID")
        private String resourceId;

        @ApiModelProperty(value = "是否强制更新")
        private Boolean force;
    }

    @Data
    public static class ContextOauthClientDTO extends OauthClientDTO {
        @ApiModelProperty(value = "客户端Key")
        private String clientKey;

        @ApiModelProperty(value = "客户端密匙")
        private String clientSecret;
    }
}
